/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Application.java
 *
 * Created on Aug 22, 2009, 6:40:34 PM
 */
package br.com.fieo.sgee.view.owner;

import br.com.fieo.sgee.logic.UserLogic;
import br.com.fieo.sgee.view.Login;
import javax.swing.JPanel;

/**
 *
 * @author rbueno
 */
public class Application extends javax.swing.JFrame {

    /** Creates new form Application */
    public Application() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        menuBar = new javax.swing.JMenuBar();
        JMenuPontosDeEnergia = new javax.swing.JMenu();
        JMenuTiposDePontos = new javax.swing.JMenu();
        JMenuRelatorios = new javax.swing.JMenu();
        jMenuItemGastosConsumos = new javax.swing.JMenuItem();
        jMenuConfiguracao = new javax.swing.JMenu();
        jMenuSair = new javax.swing.JMenu();
        jMenuProfile = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        JMenuPontosDeEnergia.setText("Pontos de Energia");
        JMenuPontosDeEnergia.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                JMenuPontosDeEnergiaMousePressed(evt);
            }
        });
        menuBar.add(JMenuPontosDeEnergia);

        JMenuTiposDePontos.setText("Tipos de Ponto");
        JMenuTiposDePontos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                JMenuTiposDePontosMousePressed(evt);
            }
        });
        menuBar.add(JMenuTiposDePontos);

        JMenuRelatorios.setText("Relatórios");

        jMenuItemGastosConsumos.setText("Gastos e Consumos");
        jMenuItemGastosConsumos.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jMenuItemGastosConsumosMousePressed(evt);
            }
        });
        JMenuRelatorios.add(jMenuItemGastosConsumos);

        menuBar.add(JMenuRelatorios);

        jMenuConfiguracao.setText("Configuração");
        jMenuConfiguracao.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jMenuConfiguracaoMousePressed(evt);
            }
        });
        menuBar.add(jMenuConfiguracao);

        jMenuSair.setText("Sair");
        jMenuSair.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jMenuSairMousePressed(evt);
            }
        });
        menuBar.add(jMenuSair);

        jMenuProfile.setText(UserLogic.getInstance().getUser().getLogin());
        jMenuProfile.setForeground(new java.awt.Color(0, 0, 153));
        jMenuProfile.setEnabled(false);
        menuBar.add(jMenuProfile);

        setJMenuBar(menuBar);

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 1012, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 717, Short.MAX_VALUE)
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-1024)/2, (screenSize.height-768)/2, 1024, 768);
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItemGastosConsumosMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItemGastosConsumosMousePressed
        this.changePanel(new ReportConsumptionEstimates());
    }//GEN-LAST:event_jMenuItemGastosConsumosMousePressed

    private void JMenuPontosDeEnergiaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JMenuPontosDeEnergiaMousePressed
        this.changePanel(new PowerPoints());
    }//GEN-LAST:event_JMenuPontosDeEnergiaMousePressed

    private void JMenuTiposDePontosMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_JMenuTiposDePontosMousePressed
        this.changePanel(new TypesOfPoints());
    }//GEN-LAST:event_JMenuTiposDePontosMousePressed

    private void jMenuConfiguracaoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuConfiguracaoMousePressed
        this.changePanel(new Configuration());
    }//GEN-LAST:event_jMenuConfiguracaoMousePressed

    private void jMenuSairMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuSairMousePressed
        this.setVisible(false);
        Login login = new Login();
        login.setVisible(true);
    }//GEN-LAST:event_jMenuSairMousePressed

    private void changePanel(JPanel panel) {
        setContentPane(panel);
        panel.revalidate();
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu JMenuPontosDeEnergia;
    private javax.swing.JMenu JMenuRelatorios;
    private javax.swing.JMenu JMenuTiposDePontos;
    private javax.swing.JMenu jMenuConfiguracao;
    private javax.swing.JMenuItem jMenuItemGastosConsumos;
    private javax.swing.JMenu jMenuProfile;
    private javax.swing.JMenu jMenuSair;
    private javax.swing.JMenuBar menuBar;
    // End of variables declaration//GEN-END:variables
}
